package com.it.service;

import com.it.mapper.ClAddressMapper;
import com.it.pojo.ClAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClAddressServiceImpl implements ClAddressService {

	//由spring创建对象并为变量赋值
	@Autowired
	private ClAddressMapper clAddressMapper;

	/**
	 * 1.查询所有地址信息
	 * @return
	 */
	public List<ClAddress> findAll(){
		//1.调用orderMapper的findAll方法查询所有地址
		List<ClAddress> list = clAddressMapper.findAll();
		return list;
	}
	
	/**
	 * 2.根据id删除地址信息
	 * @param id
	 */
	public int deleteById(String id){
		//1.调用OrderMapper的deleteById方法
		//根据id删除地址信息
		int result = clAddressMapper.deleteById(id);
		return result;
	}
	
	/**
	 * 3.添加地址信息
	 * @param address
	 */
	public int addClAddress(ClAddress address){
		int result = clAddressMapper.addClAddress(address);
		return result;
	}
	
	/**
	 * 4.根据id查询地址信息
	 * @param id
	 * @return 
	 */
	public ClAddress findById(String id){
		ClAddress address = clAddressMapper.findById(id);
		return address;
	}
	
	/**
	 * 5.根据id修改地址信息
	 * @param address
	 */
	public int updateById(ClAddress address){
		int result = clAddressMapper.updateById(address);
		return result;
	}
	
}
